//Accepted
#include <vector>
#include <set>
#include <algorithm>
#include <string>
#include <cmath>
#include <queue>
#include <map>
#include <iostream>
#include <list>
#include <deque>
#include <cstdio>
#include <cstring>
#include <cstdlib>
using namespace std;

char a[100], b[100];
int main (){
	//freopen("in.txt", "r", stdin);//freopen("out.txt", "w", stdout);
	scanf("%s\n", a);
	gets(b);
	//printf("%s\n", b);
	int n=strlen(b);
	for(int i=0;i<n;++i){
		if('a'<=b[i]&&b[i]<='z')printf("%c", tolower(a[b[i]-'a']));
		else if('A'<=b[i]&&b[i]<='Z')printf("%c", toupper(a[b[i]-'A']));
		else printf(" ");
	}
	return 0;
}
